import { createContext, ReactNode } from 'react';
import { SetState, useSetState } from '../utils';
import EditorWorkspace from '../draw/EditorWorkspace';

export type ContextCanvas = fabric.Canvas

export interface CanvasContext {
    canvas: ContextCanvas | null;
    workspace: EditorWorkspace | null;
    frontImage: fabric.Image | null;
    backImage: fabric.Image | null;
    currentTab: string;
    currentImage: fabric.Image | null;
    currentToolBarTab: string;
    setState: SetState<CanvasContext>;
}

export const Context = createContext<CanvasContext>({
    canvas: null,
    workspace: null,
    frontImage: null,
    backImage: null,
    currentTab: 'front',
    currentImage: null,
    currentToolBarTab: 'overview',
    setState: () => {}, 
});